package cz.cvut.fel.gfupan.gui.action;

import cz.cvut.fel.gfupan.gui.tab.Tabbable;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class InputKeyListener extends KeyAdapter {

    private Tabbable tab;

    public InputKeyListener(Tabbable tab) {
        this.tab = tab;
    }

    @Override
    public void keyPressed(KeyEvent evt) {
        if (KeyEvent.VK_UP == evt.getKeyCode()) {
            tab.moveFocusUp();
        } else if (KeyEvent.VK_DOWN == evt.getKeyCode()) {
            tab.moveFocusDown();
        } else if (KeyEvent.VK_LEFT == evt.getKeyCode()) {
            tab.moveFocusLeft();
        } else if (KeyEvent.VK_RIGHT == evt.getKeyCode()) {
            tab.moveFocusRight();
        }
    }
}
